<template>
  <div>
    <div>这是首页组件</div>
    <router-link to="/login">登录</router-link>
    <router-link to="/Index1">去index1</router-link>

    <div>store里面的{{ id }}</div>
    <demo1 ref="demo1Ref" title="提莫" @add="add"></demo1>
    <div
      @click="
        () => {
          count = count + 1;
        }
      "
    >
      {{ count }}
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref, onActivated, onDeactivated } from "vue";
import { useIndexStore } from "@/stores/index";
import { getData } from "@/apis/index";
import demo1 from "@/views/demo1.vue";
interface DataList {
  id: string;
  image: string;
  name: string;
  phone: string;
  address: string;
  businessHours: string;
}
const add = (value: any) => {
  console.log("add", value);
};
const count = ref(0);
const indexStore = useIndexStore();
const id = ref<number>();
id.value = indexStore.id;
const dataList = ref<DataList[]>([]);
const getHello = async () => {
  const result = await getData();
  dataList.value = result.data;
};
onMounted(() => {
  // getHello();
});
onActivated(() => {
  console.log("onActivated");
});

onDeactivated(() => {
  console.log("onDeactivated");
});
</script>

<style scoped></style>
